package com.clusterswisdom.horn.api.tmall.action.scitem;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.clusterswisdom.horn.api.ioc.HornAction;
import com.clusterswisdom.horn.api.ioc.HornResponse;
import com.clusterswisdom.horn.api.ioc.api.ApiConfig;
import com.clusterswisdom.horn.api.tmall.action.AbstractTmallAction;
import com.clusterswisdom.horn.api.tmall.action.scitem.ThreadOfStore.KeepToDb;

public class UpdateAreaStockForWarningAction extends AbstractTmallAction implements HornAction{
	@Override
	public HornResponse execute(ApiConfig config, JSONObject param)
			throws Exception {
		JSONArray items = param.getJSONArray("stockList");
		String tableName = "";
		for(Object object : items){
			JSONObject item = (JSONObject)object;
			
			//将一条或者几条（数据量非常小）数据同步到天猫中
			KeepToDb.keepAndSetItem(item,tableName);
		}
		
		return new HornResponse(true, "成功");
	}
}
